<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/icon.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript"  src="${pageContext.request.contextPath}/easyui/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>库存报表页面</title>
<script type="text/javascript">

//通过产品名称搜索
function searchStock(){
	$("#dg").datagrid('load',{
		"stockID":$("#s_stockID").val(),
		"productID":$("#s_product").combobox("getValue"),
		"wareHouseID":$("#s_wareHouse").combobox("getValue")

	});
}
//刷新
function refresh() {
	$("#dg").datagrid("load", {//使用load方法
		data : "customerName"//传到后台的变量
	});
}
var url;


//重置
function reset(){
	$("#s_stockID").val("");
	$("#s_product").combobox("setValue","");
	$("#s_wareHouse").combobox("setValue","");
	

}

//格式化
function formatProduct(val,row) {
	
	if(row.product.productName){
        return val.productName;
    }
    return val;
} 
function formatWareHouse(val,row) {
	
	if(row.wareHouse.wareHouseName){
        return val.wareHouseName;
    }
    return val;
} 
 
</script>
</head>
<body style="margin:1px;">
          <!-- 查询库存库信息 -->
	<table id="dg" title="库存信息管理" class="easyui-datagrid"
	  pagination="true" rownumbers="true"  fit="true"
	    url="${pageContext.request.contextPath}/stocklist.do"  toolbar="#tb">
		 <thead data-options="frozen:true">
				<tr>
					<th field="cb" checkbox="true" align="center"></th>
			 		<th field="stockID" width="160" align="center">库存编号</th>
			 		<th field="product" width="116" align="center" formatter="formatProduct">产品名称</th> 
                 <th field="wareHouse" width="116" align="center" formatter="formatWareHouse">仓库名称</th>
			 		<th field="productPrice" width="160" align="center">入库产品单价</th>
			 		<th field="productNum" width="160" align="center">产品数量</th>
			 		<th field="productTime" width="160" align="center">生产日期</th>
			 		
			 		
				</tr>
			</thead>
	</table>
		
	<div id="tb">
		
			&nbsp;库存编号：&nbsp;<input type="text" id="s_stockID" size="20" onkeydown="if(event.keyCode==13) searchStock()"/>

		
	 		&nbsp;产品名称：&nbsp;<input class="easyui-combobox" id="s_product" name="productID" editable="false" data-options="panelHeight:'150',editable:false,valueField:'productID',textField:'productName',url:'${pageContext.request.contextPath}/findAllProduct.do'" onkeydown="if(event.keyCode==13) searchStock()"/>
	 		&nbsp;仓库名称：&nbsp;<input class="easyui-combobox" id="s_wareHouse" name="wareHouseID" editable="false" data-options="panelHeight:'150',editable:false,valueField:'wareHouseID',textField:'wareHouseName',url:'${pageContext.request.contextPath}/findAllStockWareHouse.do'" onkeydown="if(event.keyCode==13) searchStock()/">
			
	 						
          <a href="javascript:searchStock()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
          <a href="javascript:reset()" class="easyui-linkbutton" iconCls="icon-redo" plain="true">重置</a>
          <a id="refreshbtn"
				href="javascript:refresh()" class="easyui-linkbutton"
				iconCls="icon-reload" plain="true">刷新</a>	
			<a href="${pageContext.request.contextPath }/excel/stockStatement.do" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true">导出excel</a>
		</div>
		</div>
	</div>
	
	
</body>
</html>
 